<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input {
            margin-right: 10px;
            color: #999;
        }

        button {
            width: 60px;
            background-color: rgb(0, 135, 190);
            border: 0;
            color: #fff;

        }
    </style>
</head>

<body>
    <input type="text" value="邮箱/ID/手机号">
    <input type="text" value="密码">
    <button>登录</button>
    <script>
        var ip = document.querySelectorAll('input')
        ip[0].onfocus=function(){
               if(this.value=='邮箱/ID/手机号'){
                   this.value='';
               }
               this.style.border='1px solid #666'
        }
        ip[1].onfocus=function(){
               if(this.value=='密码'){
                   this.value='';
               }
               this.type='password';
               this.style.border='1px solid #666'
        }
        ip[0].onblur=function(){
            if(this.value==''){
                this.value='邮箱/ID/手机号'
            }
                this.style.border='';
        }
        ip[1].onblur=function(){
            if(this.value==''){
                this.value='密码';
                this.type='text';
            }
                this.style.border='';
        }
    </script>
</body>

</html>